package  com.rhb.mail.mail.bean;

import java.text.*;
import java.util.*;

public class Mail implements java.io.Serializable {
	public Mail(){}

	//-----start mailPk-----//
	private String mailPk;
		
	public void setMailPk(String mailPk) {
		this.mailPk = mailPk;
	}

	public String getMailPk() {
		return this.mailPk;
	}
	//-----end mailPk-----//

	//-----start subject-----//
	private String subject;
		
	public void setSubject(String subject) {
		this.subject = subject;
	}

	public String getSubject() {
		return this.subject;
	}
	//-----end subject-----//

	//-----start content-----//
	private String content;
		
	public void setContent(String content) {
		this.content = content;
	}

	public String getContent() {
		return this.content;
	}
	//-----end content-----//

	//-----start madeDate-----//
	private java.util.Date madeDate;
		
	public void setMadeDate(String madeDate) {
		try{
			java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm");
			java.util.Calendar calendar = java.util.Calendar.getInstance();
			this.madeDate = format.parse(madeDate);
		}catch (Exception e1){
			this.madeDate = null;
		}
	}
		
	public void setMadeDate(java.util.Date madeDate) {
		this.madeDate = madeDate;
	}

	public java.util.Date getMadeDate() {
		return this.madeDate;
	}
	//-----end madeDate-----//

	//-----start madePersonPK-----//
	private String madePersonPK;
		
	public void setMadePersonPK(String madePersonPK) {
		this.madePersonPK = madePersonPK;
	}

	public String getMadePersonPK() {
		return this.madePersonPK;
	}
	//-----end madePersonPK-----//

	//-----start madePersonName-----//
	private String madePersonName;
		
	public void setMadePersonName(String madePersonName) {
		this.madePersonName = madePersonName;
	}

	public String getMadePersonName() {
		return this.madePersonName;
	}
	//-----end madePersonName-----//

	//-----start deleted-----//
	private Integer deleted;
		
	public void setDeleted(Integer deleted) {
		this.deleted = deleted;
	}

	public Integer getDeleted() {
		return this.deleted;
	}
	//-----end deleted-----//

	//-----start fatherPk-----//
	private String fatherPk;
		
	public void setFatherPk(String fatherPk) {
		this.fatherPk = fatherPk;
	}

	public String getFatherPk() {
		return this.fatherPk;
	}
	//-----end fatherPk-----//

	private Set mailItems = new HashSet();
	public Set getMailItems() {
		return mailItems;
	}
	public void setMailItems(Set items) {
		this.mailItems = items;
	}
	
	public String toString(){
		StringBuffer sb = new StringBuffer();
		sb.append("mailPK=" + this.mailPk + ",");
		sb.append("subject=" + this.subject + ",");
		sb.append("content=" + this.content + ",");
		sb.append("madePersonName=" + this.madePersonName);
		
		return sb.toString();
	}
	
	public String getReceiver() {
		StringBuffer bs = new StringBuffer(); 
		MailItem mt = null;
		Iterator it = this.getMailItems().iterator();
		while(it.hasNext()){
			mt = (MailItem)it.next();
			bs.append(mt.getReceivedPersonName() + ",");
		}
		return bs.toString();
	}
}

